package com.higgins.client.agentapp.components;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.higgins.client.GreetingService;
import com.higgins.client.GreetingServiceAsync;
import com.higgins.client.agentapp.datamodel.AgencyDTO;
import com.higgins.client.agentapp.datamodel.AgentDTO;
import com.higgins.client.agentapp.datamodel.JobSiteDTO;
import com.higgins.client.agentapp.interfaces.AgencyListListener;
import com.higgins.client.agentapp.interfaces.AgentListListener;
import com.higgins.client.agentapp.interfaces.JobSiteListListener;
import com.higgins.client.dataModel.CoveringLetterDTO;
import com.higgins.client.dataModel.RecipientCountDTO;
import com.higgins.client.dataModel.StatusDTO;
import com.higgins.client.generic.components.GenericColumns;
import com.higgins.client.generic.components.GenericColumn;

public class CorrespondenceColumns extends GenericColumns implements AgentListListener	{
	private static final Logger log = Logger.getLogger(CorrespondenceColumns.class.getName());
	private final GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);
	private boolean agentListLoaded = false;
	private AgentColumn agentColumn = null;

	public CorrespondenceColumns()	{
		super();
		initialiseColumns();
	}
	private void initialiseColumns()	{
		GenericColumn genericColumn = new GenericColumn();
		genericColumn.setTitle("ID");
		genericColumn.setIndex(0);
		genericColumn.setType(Integer.class);
		genericColumn.setWidth(25);
		genericColumn.setEditable(false);
		addColumn(genericColumn);
		
        genericColumn = new GenericColumn();
        genericColumn.setTitle("Timestamp");
        genericColumn.setIndex(1);
        genericColumn.setType(Date.class);
        genericColumn.setWidth(100);
        genericColumn.setEditable(true);
        addColumn(genericColumn);
		
		agentColumn = new AgentColumn();
		agentColumn.setTitle("Agent");
		agentColumn.setIndex(2);
		agentColumn.setType(AgentDTO.class);
		agentColumn.setWidth(150);
		agentColumn.setEditable(false);
		agentColumn.addAgentListListener(this);
		agentColumn.loadList();
		addColumn(agentColumn);
		
		genericColumn = new GenericColumn();
		genericColumn.setTitle("Description");
		genericColumn.setIndex(3);
		genericColumn.setType(String.class);
		genericColumn.setWidth(600);
		genericColumn.setEditable(true);
		addColumn(genericColumn);
		
	}
	public void setAgencyId(Long agencyId)	{
		agentColumn.setAgencyId(agencyId);
	}
	public void setAgentListLoaded(boolean loaded)	{
		agentListLoaded = false;
		this.agentListLoaded = loaded;
	}

}
